using System;
using System.Collections.Generic;
using System.Text;
using ESecretary.WinUI;
using System.Net;
using ESecretary.DataEntity;

namespace ESecretary.Business
{
    
    public class ChatManager
    {
        private static Dictionary<ChatUserInfo, FrmChat> lstChat = new Dictionary<ChatUserInfo, FrmChat>();

        public static FrmChat ShowChatFrm(ChatUserInfo user,ChatRequired required)
        {
            if (!lstChat.ContainsKey(user))
            {
                FrmChat frm = new FrmChat(user);
                if (required == ChatRequired.receive)
                {
                    frm.WindowState = System.Windows.Forms.FormWindowState.Minimized;
                }
                frm.Show();
                lstChat.Add(user, frm);               
            }            
         
            
            return lstChat[user];
        }

        public static void RemoveChatFrm(ChatUserInfo user)
        {
            lstChat.Remove(user);
        }

        public static void AddChatFrm(ChatUserInfo user,FrmChat chat)
        {
            lstChat.Add(user, chat);
        }

        public enum ChatRequired
        {
            send,
            receive,
        }
    }
}
